/*
 Copyright (C) 2008  Maurizio Monticelli

 This program is free software; you can redistribute it and/or modify it under the terms of the 
 GNU General Public License as published by the Free Software Foundation; either version 2 of the 
 License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
 even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
 Public License for more details.

 You should have received a copy of the GNU General Public License along with this program; if not, write 
 to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 
*/

package ch.justdoit.andriodrpncalc.view;

//import iconList.ch.IconifiedText;
import ch.justdoit.andriodrpncalc.model.IOnChangedListener;
import android.content.Context;
import android.text.Layout.Alignment;
import android.widget.LinearLayout;
import android.widget.TextView;

public class IStackItemView extends LinearLayout {
    private TextView mText;
    private TextView tIcon;
	private IStackItem mIStackItem;
    
    public static int HEIGHT = 21;
    
    public IStackItemView(Context context, IStackItem aIStackItem) {
         super(context);

         mIStackItem = aIStackItem;
         /* First Icon and the Text to the right (horizontal),
          * not above and below (vertical) */
         this.setOrientation(HORIZONTAL);

         tIcon = new TextView(context);
         tIcon.setText(aIStackItem.getIconText());
         // left, top, right, bottom
         tIcon.setPadding(0, 2, 5, 0); // 5px to the right
         
         /* At first, add the Icon to ourself
          * (! we are extending LinearLayout) */
         addView(tIcon,  new LinearLayout.LayoutParams(
                   LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
         
         mText = new TextView(context);
         mText.setText(aIStackItem.getText());
//         mText.setTextColor(R.color.green);
//         mText.setBackgroundColor(R.color.red);
         mText.setAlignment(Alignment.ALIGN_OPPOSITE);
        // mText.setGravity(Gravity.RIGHT);
        
         
         /* Now the text (after the icon) */
         addView(mText, new LinearLayout.LayoutParams(
                   LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    }

    public void setText(String words) {
         mText.setText(words);
    }
    
    public void setIconText(String bullet) {
         tIcon.setText(bullet);
    }


}
